<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>类选择器(针对所有元素)</title>
</head>

<body>



    <style>
        .center {
            text-align: center;
            color: red;
        }
    </style>

    <h1 class="center">居中的红色标题</h1>
    <p class="center">居中的红色段落。</p>



</html>